<!DOCTYPE html>
<html>
<head>
<meta name="layout" content="manage" />
<title>Home Page</title>
</head>
<body>
	<div class="wrapper-manage" data-toggle="context" data-target="#context-menu">
		<div id="spinner" class="hidden"></div>
		<g:hiddenField name="currentPath" value="${currentPath}"/>
		<g:hiddenField name="realCurrentPath" value="${folderInfo.realPathToFolder}"/>
		<g:hiddenField name="emailOwner" value="${folderInfo.userEmailOwner}"/>
		<!-- left panel -->
		<g:render template="/manage/managePartial/leftPanelPartial"></g:render>
		<!-- End left panel -->
		<!-- Right panel -->
		<div class="rightpanel">
			<!-- Render partial -->
			<g:render template="/manage/contextMenuPartial/mainMenuContextPartial"></g:render>
			<g:render template="/manage/managePartial/breadcrumbPartial"></g:render>
			<g:render template="/manage/managePartial/buttonPartial"></g:render>
			<g:render template="/manage/modalPartial/uploadPartial"></g:render>
			<g:render template="/manage/modalPartial/createFolderPartial"></g:render>
			<g:render template="/manage/modalPartial/createFilePartial"></g:render>
			<g:render template="/manage/modalPartial/shareFolderPartial"></g:render>
			<g:render template="/manage/modalPartial/shareFolderErrorPartial"></g:render>
			<g:render template="/manage/modalPartial/shareFilePartial"></g:render>
			<g:render template="/manage/modalPartial/shareSettingPartial"></g:render>
			<g:render template="/manage/modalPartial/renameDocumentPartial"></g:render>
			<g:render template="/manage/modalPartial/confirmDeleteDocumentPartial"></g:render>
			<g:render template="/manage/modalPartial/confirmRestoreAllDocumentPartial"></g:render>
			<g:render template="/manage/modalPartial/confirmUnshareFolderPartial"></g:render>
			<g:render template="/manage/modalPartial/folderBrowserPartial"></g:render>
			<g:render template="/manage/modalPartial/messageLimitReached"></g:render>
			<!-- End render partial -->
			<div class="tableManageDiv">
				<table id="dataTableManagement" class="table table-striped" cellspacing="0">
					<thead>
						<tr>
							<th>Name</th>
							<th>Kind</th>
							<th>Size</th>
							<th>Modified</th>
							<th class="sharecolumn"></th>
							<th>Type</th>
							<th>Url</th>
							<th>Id</th>
						</tr>
					</thead>

					<tbody>
						<g:each var="document" in="${listDocuments}" status="i">
							<tr>
								<g:if test="${document.isSharedFolder == true}">
									<g:if test="${currentPath.isEmpty()}">
										<td><a href="/manage/index?path=${document.documentName}"><asset:image src="iconManage/Share_Folder.png" />&nbsp;&nbsp;<span>${document.documentName}</span></a></td>
									</g:if>
									<g:else>
										<td><a href="/manage/index?path=${currentPath}/${document.documentName}"><asset:image src="iconManage/Share_Folder.png" />&nbsp;&nbsp;<span>${document.documentName}</span></a></td>
									</g:else>
								</g:if>
								<g:elseif test="${document.documentType == 0}">
									<g:if test="${currentPath.isEmpty()}">
										<td><a href="/manage/index?path=${document.documentName}"><asset:image src="iconManage/Folder.png" />&nbsp;&nbsp;<span>${document.documentName}</span></a></td>
									</g:if>
									<g:else>
										<td><a href="/manage/index?path=${currentPath}/${document.documentName}"><asset:image src="iconManage/Folder.png" />&nbsp;&nbsp;<span>${document.documentName}</span></a></td>
									</g:else>
								</g:elseif>
								<g:else>
									<td><a href="#"><asset:image src="iconManage/${listDocumentExtension.get(i).replaceAll('\\s','_')}.png" />&nbsp;&nbsp;<span>${document.documentName}</span></a></td>
								</g:else>
								<g:if test="${document.documentType == 0}">
									<g:if test="${document.isSharedFolder == true}">
										<td>shared folder</td>
									</g:if>
									<g:else>
										<td>folder</td>
									</g:else>
								</g:if>
								<g:else>
									<td>${listDocumentExtension.get(i)}</td>
								</g:else>
								<g:if test="${document.documentType == 0}">
									<td>--</td>
								</g:if>
								<g:else>
									<td>${listDocumentString.get(i)}</td>
								</g:else>
								<td><g:formatDate format="yyyy-MM-dd HH:mm" date="${document.createDate}"/></td>
								<td>
									<button class="btn-share-on-tr btn btn-success hidden-share" onclick="shareDocument('${document.documentType + '$' + document.documentUrl + '$' + document.documentPath}')">
										<i class="fa fa-share"></i> <span>Share</span>
									</button>
								</td>
								<td>${document.documentType}</td>
								<td>${document.documentUrl}</td>
								<td>${document.documentId}</td>
							</tr>
						</g:each>
					</tbody>
				</table>
			</div>
		</div>
		<div style="clear: both;"></div>
	</div>
	<asset:javascript src="lib/jquery.dataTables.js" />
	<asset:javascript src="lib/dataTables.responsive.js" />
	<asset:javascript src="lib/dataTables.bootstrap.js" />
	<asset:javascript src="lib/aws-sdk-2.1.25.min.js"/>
	<asset:javascript src="js/document/documentManagement.js"/>
	<asset:javascript src="js/document/folderManagement.js"/>
	<asset:javascript src="lib/ZeroClipboard.js" />
	<asset:javascript src="js/manage/context-menu.js"/>
	<asset:javascript src="lib/easyTree.js"/>
	<asset:javascript src="js/document/realtimeManagement.js"/>
</body>
</html>